|
1
|
|
|
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; |
|
2
|
|
|
|
|
3
|
|
|
@Entity() |
|
4
|
|
|
export class Contact { |
|
5
|
|
|
@PrimaryGeneratedColumn('uuid') |
|
6
|
|
|
private id: string; |
|
7
|
|
|
|
|
8
|
|
|
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) |
|
9
|
|
|
private createdAt: Date; |
|
10
|
|
|
|
|
11
|
|
|
@Column({ type: 'varchar', nullable: true }) |
|
12
|
|
|
private firstName: string; |
|
13
|
|
|
|
|
14
|
|
|
@Column({ type: 'varchar', nullable: true }) |
|
15
|
|
|
private lastName: string; |
|
16
|
|
|
|
|
17
|
|
|
@Column({ type: 'varchar', nullable: true }) |
|
18
|
|
|
private company: string; |
|
19
|
|
|
|
|
20
|
|
|
@Column({ type: 'varchar', nullable: true }) |
|
21
|
|
|
private email: string; |
|
22
|
|
|
|
|
23
|
|
|
@Column({ type: 'varchar', nullable: true }) |
|
24
|
|
|
private phoneNumber: string; |
|
25
|
|
|
|
|
26
|
|
|
@Column({ type: 'varchar', nullable: true }) |
|
27
|
|
|
private notes: string; |
|
28
|
|
|
|
|
29
|
|
|
constructor( |
|
30
|
|
|
firstName: string, |
|
31
|
|
|
lastName: string, |
|
32
|
|
|
company: string, |
|
33
|
|
|
email: string, |
|
34
|
|
|
phoneNumber: string, |
|
35
|
|
|
notes: string |
|
36
|
|
|
) { |
|
37
|
|
|
this.firstName = firstName; |
|
38
|
|
|
this.lastName = lastName; |
|
39
|
|
|
this.company = company; |
|
40
|
|
|
this.email = email; |
|
41
|
|
|
this.phoneNumber = phoneNumber; |
|
42
|
|
|
this.notes = notes; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public getId(): string | null { |
|
46
|
|
|
return this.id; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public getCreatedAt(): Date { |
|
50
|
|
|
return this.createdAt; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public getFirstName(): string | null { |
|
54
|
|
|
return this.firstName; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public getLastName(): string | null { |
|
58
|
|
|
return this.lastName; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public getCompany(): string | null { |
|
62
|
|
|
return this.company; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public getEmail(): string | null { |
|
66
|
|
|
return this.email; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public getPhoneNumber(): string { |
|
70
|
|
|
return this.phoneNumber; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public getNotes(): string { |
|
74
|
|
|
return this.notes; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public update( |
|
78
|
|
|
firstName: string, |
|
79
|
|
|
lastName: string, |
|
80
|
|
|
company: string, |
|
81
|
|
|
email: string, |
|
82
|
|
|
phoneNumber: string, |
|
83
|
|
|
notes: string |
|
84
|
|
|
): void { |
|
85
|
|
|
this.firstName = firstName; |
|
86
|
|
|
this.lastName = lastName; |
|
87
|
|
|
this.company = company; |
|
88
|
|
|
this.email = email; |
|
89
|
|
|
this.phoneNumber = phoneNumber; |
|
90
|
|
|
this.notes = notes; |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|